package com.caseProject.puremvc.mediator.gui
{
	import com.caseProject.puremvc.mediator.events.GraphicEvent;
	
	import flash.display.NativeMenuItem;
	import flash.events.Event;

	public class Partition extends Element
	{
		private var elements:Vector.<Element>;
		
		public function Partition()
		{
			super();
			
			this.elements = new Vector.<Element>();
		}
		
		private function addElement(e:Element):void
		{
			this.elements.push(e);
		}
		
		private function removeElement (e:Element):void
		{
			var id:int = this.elements.indexOf(e);
			if (id != -1) {
				this.elements.splice(id, 1);
			} else {
				trace ("element not exists.")
			}
		}
		
		private function getElement (id:int):Element
		{
			for each (var e:Element in this.elements) 
			{
				if (e.id == id) {
					return e;
				}
			}
			return null;
		}
		
		override protected function onSelectDel(event:Event):void
		{
			this.dispatchEvent(new GraphicEvent(GraphicEvent.DELETE_PARTITION, this.vo, true));
			this.parent.removeChild(this);			
		}
	}
}